define(function () {
    'use strict';
    function ctrl($scope, LocalCacheService, DictionaryService, CommonService, WTService) {
        function init() {
            $scope.professions = DictionaryService.getProfessionAds();
            $scope.user = LocalCacheService.getUser();
        }

        $scope.$on('$ionicView.beforeEnter', function () {
            init();
        });

        $scope.change = function () {
            WTService.modifyProfession($scope.user.profession_code).then(
                function () {
                    LocalCacheService.setUser($scope.user);
                }, function () {
                    CommonService.showAlert({message: "修改失败"});
                }
            )
        }
    }

    ctrl.$inject = ['$scope', 'LocalCacheService', 'DictionaryService', 'CommonService', 'WTService'];
    return ctrl;
});